#pragma once

#include "includeBase.h"

#include "ReportControlType.h"
#include "ReportFieldType.h"
#include "ReportTextAlign.h"

class Report
{

public:
    Report(QWidget* parent);

public:
    QAxObject* GetReport() const;
    void LoadFromFile(const QString& reportFile);

    void PrintPreview(bool showModal);
    void Print(bool showModal);

    void ClearColumns();
    QAxObject* AddColumn(
        const QString& Name,
        const QString& Title,
        const QString& DataField,
        double Width
    );
    QAxObject* AddControl(
        QAxObject* column,
        ReportControlType controlType,
        const QString& Name,
        double Left,
        double Top,
        double Width,
        double Height,
        const QString& DataField = ""
    );
    void setFontPoint(QAxObject* control, double point);
    QAxObject* AddField(const QString& Name, ReportFieldType fieldType);
    void ColumnFreeCell(QAxObject* column, bool free);
    void setPrarameter(const QString& name, const QString& value);
    void setField(const QString& name, const QString& value);
    void setControlText(const QString& name, const QString& text);
    void setControlImage(const QString& name, const QString& imagePath);
    void Append();
    void Post();

public:
    QAxObject* DetailGrid();
    QAxObject* RecordSet();
    QAxObject* ColumnContent();

private:
    QAxObject* report_;
    QAxObject* detailGrid_;
    QAxObject* recordSet_;
    QAxObject* columnContent_;
};
